<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
</head>
<body>
    <div id="app">
       <p>{{date1}}</p>
    </div>
    <script>
        Vue.createApp({
            data(){
                return{
                    date1:'00:00:00'
                }
               
            },
            //mounted() 生命周期  DOM挂载后
            mounted(){
                setInterval(() => {
                    let d = new Date();
                    this.date1 = d.getHours() + ':' + d.getMinutes() + ':' + d.getSeconds();
                }, 1000);
            }
        }).mount("#app");
    </script>
</body>
</html>